package com.harmontronics.hanma.paas.paas.domain.app.repository.persistence;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.harmontronics.hanma.paas.paas.domain.app.entity.HmEntityModel;
import com.harmontronics.hanma.paas.paas.domain.app.entity.valueobject.Fields;
import com.harmontronics.hanma.paas.paas.domain.app.repository.mapper.HmPublishedEntityModelMapper;
import com.harmontronics.hanma.paas.paas.domain.app.repository.po.HmPublishedEntityModelPO;
import org.springframework.stereotype.Repository;


/**
 * @author ldb
 */
@Repository("hmPublishedEntityModelRepository")
public class HmPublishedEntityModelRepository extends ServiceImpl<HmPublishedEntityModelMapper, HmPublishedEntityModelPO> {

    public IPage<HmPublishedEntityModelPO> selectPage(QueryWrapper<HmPublishedEntityModelPO> queryWrapper, Page<HmPublishedEntityModelPO> page) {
        return baseMapper.selectPage(page, queryWrapper);
    }

    public List<HmPublishedEntityModelPO> findByPublishId(Long publishId) {
        QueryWrapper<HmPublishedEntityModelPO> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq(Fields.PUBLISH_ID,publishId);
        queryWrapper.orderByAsc(Fields.SERIAL_NUM);
        return baseMapper.selectList(queryWrapper);
    }


    public IPage<HmEntityModel> findByPublishId(boolean hiddenSystemField,Long modelId,Long publishId,Page page){
        return baseMapper.findByPublishId(modelId,publishId,hiddenSystemField,page);
    }
}